package com.poe.service.serviceiImpl.book;

import com.poe.entity.Book;
import com.poe.mapperDao.read.book.ReadBookDao;
import com.poe.mapperDao.write.book.WriteBookDao;
import com.poe.service.ibook.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("bookService")
@Transactional
public class BookServiceImpl implements BookService {
	@Autowired
	private ReadBookDao readBookDao;
	@Autowired
	private WriteBookDao writeBookDao;

	@Override
	public boolean addBook(Book book) {
		try {
			writeBookDao.addBook(book);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	@Override
	public List<Book> findBook(int startPage) {
		return readBookDao.findBook(startPage);
		
	}
	@Override
	public List<Book> findAllBook() {
		return readBookDao.findAllBook();
	}
	@Override
	public Book findBookProduct(String bookId) {
		return readBookDao.findBookProduct(bookId);
	}
//	@Override
//	public List<Book> findBookForType(String bookPress, int startPage) {
//		
//		return bookDao.findBookForType(bookPress, startPage);
//	}

}
